﻿using System;

namespace HashFoo.Core
{
    /// <summary>
    /// Token interface that allows async control over a <see cref="IWebClient"/> operation.
    /// </summary>
    public interface IWebClientOperation
    {
        /// <summary>
        /// Cancels a web client operation.
        /// </summary>
        void Cancel();

        /// <summary>
        /// True if the operation is no longer active.  If true, it does not necessarily mean
        /// the operation was completed successfully, just that its done.
        /// </summary>
        bool IsDone { get; }

        /// <summary>
        /// Raised when the operation is completed (could be error, cancel, or success).
        /// </summary>
        event Action Completed;
    }
}